<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var b=10;
    function f(){
        var a,b,c;
        var a=b;
        var c=10;
        var b=c;
        console.log(a,b);
    }
    f();

    var num=100;
    function fun(){
        console.log(num);
        var num;
    }
    fun();

    var num=123;
    function f1(num){
        console.log(num);
    }
    function f2(){
        var num=456;
        f1(num)
    }
    f2();


    var b=2;
    function test2(){
        window.b=3;
        console.log(b);
    }
    test2();
    //任何通过附加在window上的变量都相当于声明一个全局变量 或者是给全局变量赋值


    c=5;
    function test3(){
        window.c=3;
        console.log(c);
        var c;
        console.log(window.c)
    }
    test3();

    c=5;
    function test3(){
        var c;
        window.c=3;
        console.log(c);
        console.log(window.c)
    }
    test3();



    var a=100;
    function f(){
        var b=2*a;
        var a=200;
        var c=a/2;
        console.log(b);//NaN
        console.log(c);//
        console.log(a);
    }
    f();
    console.log("a"*"b");
</script>
</html>